package com.sws.orderMS.pojo;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Order {

	private long id;
	private String orderNo;
	private List<OrderItem> orderList;
	private Timestamp timeStamp;
	private String memo;
	private double total;
	private static Map<Integer, String> orderStatus;
	private static Map<Integer, String> paymentStatus;
	private static Map<Integer, String> paymentMethods;
	private int currentStatus;
	private int currentPaymentStatus;
	private int paymentMethodId;
	
	static {
		orderStatus = new HashMap<Integer, String>();
		paymentStatus = new HashMap<Integer, String>();
		paymentMethods = new HashMap<Integer, String>();
		orderStatus.put(1, "订单已确认");
		orderStatus.put(2, "订单已取消");
		orderStatus.put(3, "订单已删除");
		orderStatus.put(4, "订单已完成");
		
		paymentStatus.put(1, "等待支付");
		paymentStatus.put(2, "支付成功");
		paymentStatus.put(3, "支付失败");
		paymentStatus.put(4, "取消支付");
		
		paymentMethods.put(1, "支付宝");
		paymentMethods.put(2, "微信");
		paymentMethods.put(3, "银联卡");
	}
	
	public Order() {
	}
	
	public Order(long id, String orderNo, List<OrderItem> orderList, 
			Timestamp timeStamp, String memo, double total, int currentStatus,
			int paymentStatus, int paymentMethodId) {
		this.id = id;
		this.orderNo = orderNo;
		this.orderList = orderList;
		this.timeStamp = timeStamp;
		this.memo = memo;
		this.total = total;
		this.currentStatus = currentStatus;
		this.currentPaymentStatus = paymentStatus;
		this.paymentMethodId = paymentMethodId;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public Timestamp getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Timestamp timeStamp) {
		this.timeStamp = timeStamp;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public int getCurrentStatus() {
		return currentStatus;
	}

	public void setCurrentStatus(int currentStatus) {
		this.currentStatus = currentStatus;
	}

	public int getCurrentPaymentStatus() {
		return currentPaymentStatus;
	}

	public void setCurrentPaymentStatus(int currentPaymentStatus) {
		this.currentPaymentStatus = currentPaymentStatus;
	}

	public int getPaymentMethodId() {
		return paymentMethodId;
	}

	public void setPaymentMethodId(int paymentMethodId) {
		this.paymentMethodId = paymentMethodId;
	}

	public String getOrderStatus(int key) {
		return orderStatus.get(key);
	}
	
	public String getPaymentStatus(int key) {
		return paymentStatus.get(key);
	}
	
	public String getPaymentMethod(int key) {
		return paymentMethods.get(key);
	}
	
	public List<OrderItem> getOrderList() {
		return orderList;
	}
	
	public void setOrderList(List<OrderItem> orderList) {
		this.orderList = orderList;
	}
	
	public void addItem(OrderItem item) {
		orderList.add(item);
	}
	
	public boolean removeItem(OrderItem item) {
		return orderList.remove(item);
	}
	
	public void removeAll(List<OrderItem> removeList) {
		orderList.removeAll(removeList);
	}
	
	public double getTotal() {
		return total;
	}
	
	public void setTotal(double total) {
		this.total = total;
	}
	
//	public String toString() {
//		return "";
//	}
}
